home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1 / Ian and Stuart's One (Australia).iso / Australasian Legends / Commercial / Rainbow Hill / MacDOS™ 2.0.0 / User's Guide / 05 Working with Folders < prev    next >
Text File  |  1994-09-20  |  14KB  |  283 lines

  1. 5  Working with Folders
  2.        This  section  describes the MacDOS commands which  let  you
  3.        work  with folders. Refer to the section "Data on  the  Mac"
  4.        for an introduction to the concept of "folder".
  5.  
  6.        Several  MacDOS commands operate on folders. To tell  MacDOS
  7.        where  to  look  for  them,  you specify  the  folder  which
  8.        contains them. If you do not specify any containing  folder,
  9.        MacDOS operates within what is called the "current folder".
  10.  
  11. Identifying a Folder
  12.        A  folder  is identified through its name and its  location.
  13.        The  name alone is not enough because there could be several
  14.        folders  in  the system with the same name. The location  is
  15.        nothing  more  than the identification of the  folder  where
  16.        the  folder in question is to be found. This only shifts the
  17.        problem of identification "up" (or "out") one level, but  it
  18.        works  if  you  repeat  it  until  you  arrive  to  the  top
  19.        (or  outermost)  folder  on the volume.  Such  a  folder  is
  20.        unique  for each volume and is referred to as "the root"  of
  21.        the volume.
  22.  
  23.        To  put  it more clearly, in order to identify a folder  you
  24.        must provide:
  25.          •     Identification  of  the  volume  where  the   folder
  26.           resides (ie. the volume ID).
  27.          •    The  name of all folders, one inside the other, which
  28.           you  need to open in order to "reach" the folder you  are
  29.           looking for. You start from the outermost folder  on  the
  30.           volume (ie. the root) which is unique on the volume.
  31.          •   The name of the folder itself.
  32.  
  33.        Such an identification in MacDOS looks something like this:
  34.           1:\fold1\aDeeperFold\still deeper\myFold
  35.        where:
  36.          •   "1" is the volume ID.
  37.          •    The  first backslash stands for the root, which  does
  38.           not need to be named because it is unique on the volume.
  39.          •    "fold1",  "aDeeperFold", and "still deeper"  are  the
  40.           names  of  the three folders which are between  the  root
  41.           and  the  folder  you  want to identify.  Note  that  the
  42.           backslashes  delimit the names but do not  form  part  of
  43.           them.
  44.          •    "myFold"  is the name of the folder you  are  looking
  45.           for.
  46.  
  47.        Folder  names are strings of up to 31 characters in  length.
  48.        They  are not allowed to contain colons, but you should also
  49.        avoid  other special characters, as they can create problems
  50.        and  confusion. For example, if you include  a  slash  in  a
  51.        folder  name and then forget to double quote the  name  when
  52.        you  use  it  in a command, MacDOS will interpret  the  part
  53.        beginning with the slash as a switch. Moreover, most  MacDOS
  54.        commands  reject  names beginning with a slash  whether  you
  55.        double  quote them or not. For similar reasons,  backslashes
  56.        should  also  be avoided. Also note that if  you  include  a
  57.        semicolon in a folder name, you will not be able to  use  it
  58.        in  the  PATH  system  variable. In general,  try  to  avoid
  59.        characters which are used as separators.
  60.  
  61.        A  sequence  of folders within folders separated by  slashes
  62.        is  called a "path". If it starts with a backslash  (ie.  if
  63.        it  includes  the root) the path is said to  be  "absolute",
  64.        otherwise     it     is    "relative".     For     instance,
  65.        "\fold1\aDeeperFold"    is   an   absolute    path,    while
  66.        "aDeeperFold\still deeper" is relative.
  67.  
  68.        Fortunately,  in  most cases you do not  need  to  type  the
  69.        volume  ID  and  the  whole absolute path.  You  can  direct
  70.        MacDOS  to  memorise a particular absolute  path  and  never
  71.        have  to  specify it again until you need to change  it.  In
  72.        fact,  you can tell MacDOS to memorise an absolute path  for
  73.        each  mounted volume. Such a "default path" for a particular
  74.        volume is called the "current folder" of that volume.
  75.  
  76.        A  backslash  within  a path directs  MacDOS  to  "enter"  a
  77.        subfolder.  That is, to go one level "down"  (or  "in").  In
  78.        order to access one of the folders between the root and  the
  79.        current folder, you must also be able to tell MacDOS  to  go
  80.        one  level "up" (or "out"). For this purpose, MacDOS accepts
  81.        the  fictitious folder name "..": when you type  a  pair  of
  82.        periods  (ie.  dots) in place of a real folder name,  MacDOS
  83.        backtracks  one  item in the default path.  Naturally,  this
  84.        means that you should not use ".." to name folders.
  85.  
  86.        Let's bring everything together with some examples:
  87.          •   You have two volumes: 1 and 2.
  88.          •    The  current volume is 1. That is, you are "attached"
  89.           to volume 1.
  90.          •    The  current  folder of volume 1 is  "\aaa\bbb"  (the
  91.           path   which  identifies  a  current  folder  is   always
  92.           absolute).
  93.          •    The  current folder of volume 2 is its root (ie.  the
  94.           default path is just "\").
  95.        Under these circumstances,
  96.          this                 is equivalent to
  97.          fold                 1:\aaa\bbb\fold
  98.          2:fold               2:\fold
  99.          \fold                1:\fold
  100.          ..\fold              1:\aaa\fold
  101.          ..\bbb\..\bbb\..     1:\aaa
  102.          ..\..                1:\
  103.  
  104.        Immediately after launching MacDOS, the default path is  set
  105.        to   identify   the   folder  which  contains   the   MacDOS
  106.        application  file.  Therefore, until you  direct  MacDOS  to
  107.        change  the  current  volume or  the  current  folder,  your
  108.        commands  operate by default on the contents of  the  folder
  109.        which contains MacDOS itself.
  110.  
  111. Creating Folders
  112.        You  can  create a new folder with the command MKDIR  (which
  113.        stands  for  MaKe DIRectory). You can also abbreviate  MKDIR
  114.        to MD.
  115.  
  116.        MD  accepts a single parameter which specifies the folder to
  117.        be  created. For example, you can create a new folder in the
  118.        current folder simply by typing:  MD newFolderName.
  119.  
  120. Removing Folders
  121.        You  can  remove  a  folder with the command  RMDIR  (ReMove
  122.        DIRectory), which can be abbreviated to RD.
  123.  
  124.        Similarly  to  MD,  RD  accepts  a  single  parameter  which
  125.        specifies  the folder. To remove a folder contained  in  the
  126.        current folder, type:  RD oldFolderName.
  127.  
  128.        Note  that  you  can  only remove empty  folders.  The  file
  129.        deldir.bat  in the original MacDOS floppy is an  example  of
  130.        how you can remove non-empty folders.
  131.  
  132. Renaming Folders
  133.        You  can change the name of a folder with the command RENDIR
  134.        (REName DIRectory).
  135.  
  136.        RENDIR accepts two parameters, to identify the folder to  be
  137.        renamed and to provide the new name.
  138.  
  139. Listing Folders
  140.        You  can  list  the contents of a folder with two  commands:
  141.        DIR  and  TREE. They both accept a parameter which specifies
  142.        the folder to be listed.
  143.  
  144.        DIR  provides the following information on each item (folder
  145.        or file) in the folder:
  146.          •   item name;
  147.          •    size  in bytes if the item is a normal file or volume
  148.           ID of the target if it is an alias;
  149.          •   file creator and type if the item is a file;
  150.          •   date and time of last update.
  151.        For aliases, DIR displays a second line with information  on
  152.        the  target. For chains of aliases, DIR displays information
  153.        on  the  alias in the folder being listed and on the target,
  154.        but not on the intermediate aliases.
  155.        DIR  also displays the volume name and the absolute path  of
  156.        the  folder  being listed, as well as the  total  number  of
  157.        bytes occupied.
  158.  
  159.        TREE  displays the name of the items in a graphical way,  so
  160.        that   the   hierarchical  structure  of   the   folder   is
  161.        highlighted.
  162.  
  163.        You  can  direct  both DIR and TREE to select  a  subset  of
  164.        items  by  extending the parameter to include  a  wildcarded
  165.        filename. In addition, several switches allow you to  select
  166.        what to list:
  167.          •   files;
  168.          •   folders;
  169.          •   files of a certain creator;
  170.          •   files of a certain type;
  171.          •   hidden files;
  172.          •   aliases.
  173.        Through  the switch /O, you can also obtain lists  in  which
  174.        the  items are sorted on the basis of their name, size, last
  175.        update, and whether they are folders or files.
  176.  
  177.        Through  the switch /S, you can display information  on  the
  178.        whole  hierarchy  of  folders and  files  contained  in  the
  179.        specified folder.
  180.  
  181.        If  you  "are  lost"  and would like to find  out  what  the
  182.        current  folder is, type CD. You normally use  this  command
  183.        to  change the default folder (see below for a description),
  184.        but  without parameter it tells you where you are.  Perhaps,
  185.        the  best  way  of  always knowing "where  you  are"  is  to
  186.        include the option $p in the PROMPT.
  187.  
  188. Changing the Current Folder
  189.        Immediately  after launching MacDOS, the current  folder  is
  190.        the  folder which contains the MacDOS application file. This
  191.        is  true  regardless of whether you launch MacDOS by  double
  192.        clicking on a text file with creator 'mDOS', on an alias  of
  193.        MacDOS, or on the application file itself.
  194.  
  195.        You  can  change the current folder with the  command  CHDIR
  196.        (CHange  DIRectory), which can be abbreviated to  CD.  CHDIR
  197.        accepts  a  single parameter which specifies the folder  you
  198.        want  to  make  current. If the folder  is  on  a  different
  199.        volume,  MacDOS  automatically attaches to  the  new  volume
  200.        before changing folder.
  201.  
  202.        CHDIR  without  parameter tells you the current  volume  and
  203.        folder.
  204.  
  205. Copying Folder Contents
  206.        You  can copy all the items contained in a folder to another
  207.        folder with the command XCOPY. The format of XCOPY is:
  208.           XCOPY sourceFolder destinationFolder
  209.  
  210.        By  default, XCOPY only copies the files and does  not  look
  211.        inside   subfolders.  To  copy  everything,  so   that   the
  212.        destination  folder  is  identical to  the  source  both  in
  213.        hierarchical structure and contents, use the switch /E.
  214.  
  215.        Other  switches let you select files of a particular creator
  216.        or type, or files updated after a certain date.
  217.  
  218.        Note  that XCOPY does not make a copy of the folder  itself.
  219.        Therefore,  if you want to copy a folder with its  contents,
  220.        you  must  first create the destination folder. For example,
  221.        to duplicate the folder aFold, type what follows:
  222.           mkdir "aFold copy"
  223.           xcopy/e aFold "aFold copy"
  224.  
  225. Special Folders
  226.        The  Macintosh  Finder  gives you the  impression  that  the
  227.        desktop  is  the base of everything: volumes,  folders,  and
  228.        files  rest on the desktop, and when you move a file from  a
  229.        folder  window  to the desktop you have the impression  that
  230.        you  are  moving it "out". In reality, each  volume  (eg.  a
  231.        floppy) has its own desktop, and desktops are just folders.
  232.  
  233.        Earlier  on, you have learnt that each volume has  a  "root"
  234.        folder  which contains everything. If you wanted to  give  a
  235.        name  to the root folder, it would be reasonable to name  it
  236.        like  the volume itself. Nevertheless, to type the root name
  237.        would be a waste of energy, because it could only appear  at
  238.        the  beginning  of an absolute path. That is why  in  MacDOS
  239.        (as  in  DOS) the name is dropped altogether, and  the  root
  240.        folder is just identified by a backslash on its own.
  241.  
  242.        The  Macintosh  Finder has implemented a  similar  strategy:
  243.        when  you double click on a volume icon (eg. the icon  of  a
  244.        floppy),  the Finder opens a window which has the same  name
  245.        as the volume and shows the contents of the root.
  246.  
  247.        In   each   root   there  are  two  special  folders   named
  248.        "Desktop Folder" and "Trash". With MacDOS you can see  these
  249.        two folders of the startup volume by typing:
  250.             cd  1:\     this  attaches  you  to  the  root  of  the
  251.        startup volume;
  252.             dir/a:h     this  lists  the  contents  of   the   root
  253.        including hidden items.
  254.  
  255.        The  Finder tricks you into believing that there is a single
  256.        desktop  by displaying together the contents of the  desktop
  257.        folders  of all mounted volumes. It does the same  with  the
  258.        trash can. You do not see these two folders when you open  a
  259.        volume  window (ie. when you open the root folder by  double
  260.        clicking on the volume icon) because the Finder hides  them:
  261.        they are there but you cannot see them.
  262.  
  263.        If  you insert a floppy and use DIR to list the contents  of
  264.        the  root,  you  might find that one or both  of  these  two
  265.        special  folders are missing. The reason is  that  they  are
  266.        not  automatically  created when the  floppy  is  formatted.
  267.        They are only created when they are needed the first time.
  268.  
  269.        One  final point needs to be made concerning the issue  "one
  270.        desktop  per  volume":  dir "\Desktop  Folder"   only  lists
  271.        what  is  in  the  desktop  folder of  the  current  volume.
  272.        Similarly,   dir  \Trash  only lists what was  trashed  from
  273.        the  current volume. This way of displaying all desktop  and
  274.        trash  folders separately might look like a limitation,  but
  275.        it  gives you more control than the Finder. For example,  it
  276.        lets  you  selectively empty the Trash Can of  a  particular
  277.        volume  (you  need  a short batch program  modelled  on  the
  278.        example  deldir.bat provided in your MacDOS  disk).  If  you
  279.        want  to  access all the desktop or trash folders  together,
  280.        you  can always write a small batch program which scans  all
  281.        your volumes.
  282.  
  283.